<!DOCTYPE html>
<html>

<head>
<meta charset="UTF-8">
<title>欢迎页面-X-admin2.0</title>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"
	content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
<link rel="stylesheet" href="./css/font.css">
<link rel="stylesheet" href="./css/xadmin.css">
<script type="text/javascript"
	src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
<script type="text/javascript" src="./lib/layui/layui.js"
	charset="utf-8"></script>
<script type="text/javascript" src="./js/xadmin.js"></script>
<!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
<!--[if lt IE 9]>
      <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
      <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>

<body>
	<div class="x-nav">
		<span class="layui-breadcrumb"> <a href="">首页</a> <a href="">演示</a>
			<a> <cite>导航元素</cite></a>
		</span> <a class="layui-btn layui-btn-small"
			style="line-height: 1.6em; margin-top: 3px; float: right"
			href="javascript:location.replace(location.href);" title="刷新"> <i
			class="layui-icon" style="line-height: 30px">ဂ</i></a>
	</div>
	<div class="x-body">
		<div class="layui-row">
			<form class="layui-form layui-col-md12 x-so" id="userFrom">
				<input type="text" name="userAlias" placeholder="请输入用户名"
					autocomplete="off" class="layui-input"> <a
					href="javascript:;" class="layui-btn" lay-filter="sreach"
					id="sreach"> <i class="layui-icon">&#xe615;</i></a>
			</form>
		</div>
		<xblock> </xblock>
		<table id="userTable" lay-filter="test" style="margin-top: 20px;"></table>
	</div>
	<script>
		$(function() {
			$("#sreach").click(function() {
				layui.use('table', function() {
					var table = layui.table;
					table.render({
						elem : '#userTable',
						url : '/user/aaa' //数据接口
						,
						page : true, //开启分页
						limits : [ 4, 6, 10], //每页数量可选
						limit : 4 // 默认是4
						,
						cols : [ [ //表头
							{
								field : 'userId',
								title : 'ID',
								width : 192,
								sort : true,
								fixed : 'left'
							}, {
								field : 'userAlias',
								title : '用户名',
								width : 190
							}, {
								field : 'userPhone',
								title : '电话',
								width : 193,
								sort : true
							}, {
								field : 'uTypeId',
								title : '用户类型',
								width : 199,
								templet : "#uTypeId"
							}, {
								field : 'userStatus',
								title : '状态',
								width : 199,
								templet : "#userStatus"
							}, {
								field : 'createTime',
								title : '创建时间',
								width : 199,
								sort : true,
								templet : "#createTime"
							} ] ],
						where : {
							userAlias : $("[name='userAlias']").val(),
							kDate : $("[name='createTime']").val()
						}
					});
				})
			})
		})

		layui.use('table', function() {
			var table = layui.table;
			table.render({
				elem : '#userTable',
				url : '/user/aaa' //数据接口
				,
				page : true, //开启分页
				limits : [ 4, 6, 10 ], //每页数量可选
				limit : 4 // 默认是4
				,
				cols : [ [ //表头
				{
					field : 'userId',
					title : 'ID',
					width : 192,
					sort : true,
					fixed : 'left'
				}, {
					field : 'userAlias',
					title : '用户名',
					width : 190
				}, {
					field : 'userPhone',
					title : '电话',
					width : 193,
					sort : true
				}, {
					field : 'uTypeId',
					title : '用户类型',
					width : 199,
					templet : "#uTypeId"
				}, {
					field : 'userStatus',
					title : '状态',
					width : 199,
					templet : "#userStatus"
				}, {
					field : 'createTime',
					title : '创建时间',
					width : 199,
					sort : true,
					templet : "#createTime"
				} ] ]
			});

		});
		function getCreateTime(value) {
			return new Date(parseInt(value)).toLocaleString().replace(
					/:\d{1,2}$/, ' ');
		}
	</script>
	<script>
		var _hmt = _hmt || [];
		(function() {
			var hm = document.createElement("script");
			hm.src = "https://hm.baidu.com/hm.js?b393d153aeb26b46e9431fabaf0f6190";
			var s = document.getElementsByTagName("script")[0];
			s.parentNode.insertBefore(hm, s);
		})();
	</script>
	<script type="text/html" id="createTime">
		
	 {{#  if(d.createTime!=null){ }}
 		  {{ getCreateTime(d.createTime)}}
 	 {{#  } else { }}
 	 {{#  } }}
	</script>

	<script type="text/html" id="uTypeId">
	 {{#  if(d.uTypeId==1){ }}
 		  普通用户
 	 {{#  } else { }}
 	 {{#  } }}
	{{#  if(d.uTypeId==2){ }}
 		  月卡会员
 	 {{#  } else { }}
 	 {{#  } }}
	{{#  if(d.uTypeId==3){ }}
 		  年卡会员
 	 {{#  } else { }}
 	 {{#  } }}
 	{{#  if(d.uTypeId==4){ }}
 		  管理员
 	 {{#  } else { }}
 	 {{#  } }}
	</script>

	<script type="text/html" id="userStatus">
	{{#  if(d.userStatus==0){ }}
 		  正常
 	 {{#  } else { }}
 	 {{#  } }}
	{{#  if(d.userStatus==1){ }}
 		  失效
 	 {{#  } else { }}
 	 {{#  } }}

</script>
</body>

</html>